package edu.nus.mtech.sem1.ca.utils.fun;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Properties;

import edu.nus.mtech.sem1.ca.data.ConfigurationUtils;
import edu.nus.mtech.sem1.ca.utils.TelephonyConstants;

public class TelephonyBanner {


	private static BufferedReader bufferedReader=null;
	
	private static void initialize() {
		try {
			Properties applicationConfiguration = ConfigurationUtils.loadConfiguration(); 
			FileReader fileReader=new FileReader(System.getProperty("user.dir")+"/"+ applicationConfiguration.getProperty(TelephonyConstants.BANNER_FILE_LOCATION));
	        bufferedReader = new BufferedReader(fileReader);
	        
		} catch (IOException e) {
			System.err.print("Banner could not initialized. Chuck it");
			e.printStackTrace();
		}

	}
	
	public static void showBanner(){
		try {
			initialize();
			if (bufferedReader==null){
				return;
			}
			else{
				String thisLine=null;
				while ((thisLine=bufferedReader.readLine())!=null){
					System.out.println(thisLine);
				}
			}
		} catch (IOException e) {
			System.err.println("Banner isnt coming up. I hate it but we can proceed with the program");
			//e.printStackTrace();
		}
		
	}
   
	public static void main(String[] args) {
		TelephonyBanner.showBanner();
	}
}
